#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ld long double
#define ll long long
#define S second
#define F first
using namespace __gnu_pbds;
using namespace std;
typedef tree<long long, null_type, less_equal<long long>,
rb_tree_tag, tree_order_statistics_node_update> Tree;
const ll INF = 9223372036854775807LL;
const ll inf = 2147483647;
const ll MAXN = 200010;
const ll MOD = 1e9 + 7;
const ld PI = acos(-1);
const ll NROOT = 320;
ll binpow(ll a, ll b) {
ll res = 1;
for (;b; b /= 2, a *= a, a %= MOD)
if (b & 1) res *= a, res %= MOD;
return res % MOD;
}
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a * b / gcd(a, b);}
ll invmod(ll a) {return binpow(a, MOD - 2);}
vector<bool> s(1e6 + 1, 1);
void sieve() {
s[0] = s[1] = 0;
for (ll i = 2; i * i <= 1e6; i ++) {
if (s[i]) {
for (ll j = i * i; j <= 1e6; j += i) {
assert(j > 0 && j <= 1e6);
s[j] = 0;
}
}
}
}
int32_t main () {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
sieve();
int n, m; cin >> n >> m;
vector<vector<pair<int, int>>> ans(n + 1);
ans[1].push_back({n, 2});
int spt = 2;
for (int i = 2; i < n; i ++) {
ans[1].push_back({i, 1});
spt ++;
}
while (!s[spt]) {
spt ++;
ans[1][1].S ++;
}
m -= (n - 1);
for (int i = 2; i <= n && m; i ++) {
for (int j = i + 1; j <= n && m; j ++) {
ans[i].push_back({j, spt + 1});
m --;
}
}
cout << 2 << " " << spt << "\n";
for (int i = 1; i <= n; i ++) {
for (auto &x : ans[i]) {
assert(x.S <= spt + 1);
cout << i << " " << x.F << " " << x.S << "\n";
}
}
return 0;
}
1455B - Jumps | 1225C - p-binary |
1525D - Armchairs | 1257A - Two Rival Students |
1415A - Prison Break | 1271A - Suits |
259B - Little Elephant and Magic Square | 1389A - LCM Problem |
778A - String Game | 1382A - Common Subsequence |
1512D - Corrupted Array | 667B - Coat of Anticubism |
284B - Cows and Poker Game | 1666D - Deletive Editing |
1433D - Districts Connection | 2B - The least round way |
1324A - Yet Another Tetris Problem | 246B - Increase and Decrease |
22E - Scheme | 1566A - Median Maximization |
1278A - Shuffle Hashing | 1666F - Fancy Stack |
1354A - Alarm Clock | 1543B - Customising the Track |
1337A - Ichihime and Triangle | 1366A - Shovels and Swords |
919A - Supermarket | 630C - Lucky Numbers |
1208B - Uniqueness | 1384A - Common Prefixes |